package com.cskaoyan.feign.call;

import com.cskaoyan.api.bean.Person;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 创建日期: 2023/01/06 14:38
 *
 * @author ciggar
 */
@RestController
public class CallController {

    @GetMapping("call/v1")
    public String call(String name) throws InterruptedException {
        String resp = "hello open feign:" + name;

        Thread.sleep(4000l);

        return resp;
    }

    @PostMapping("call/v2")
    public String call2(@RequestBody Person person){

        String name = person.getName();
        String resp = "hello open feign with person:" + name;

        return resp;
    }
}
